#include <iostream>
#include <vector>
#include <list>
#include <iterator>
#include <algorithm>
#include <set>

using namespace std;

void test0(){
    vector<int> vec = {1, 2, 3, 5, 8};
    list<int> li = {3, 8, 1};

//    尾插
//    copy(vec.begin(), vec.end(), back_insert_iterator<list<int>>(li));
//    copy(li.begin(), li.end(), ostream_iterator<int>(cout, " "));

//    头插
//    copy(vec.begin(), vec.end(), front_inserter(li));
//    copy(vec.begin(), vec.end(), ostream_iterator<int>(cout, " "));


    set<int> st = {1, 2,4 ,6 ,8, 9};
    auto it = st.begin();
    copy(vec.begin(), vec.end(), inserter(st, it));
    copy(st.begin(), st.end(), ostream_iterator<int>(cout, " "));

}

int main() {
    test0();
    return 0;
}
